/*
 * FileSender.java
 *
 * Created on 25 f�vrier 2008, 18:42
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package br.great.functionalCore;

import java.io.*;

/**
 *
 * @author defautce
 */
public class FileSender {
    
    /** Creates a new instance of FileSender */
    public FileSender() {
    }
    
    public static void senderFile(String originalPath, String finalPath) throws IOException {
        File inputFile = new File(originalPath);
        File outputFile = new File(finalPath);
        if(!outputFile.exists())
            outputFile.createNewFile();

        FileInputStream in = new FileInputStream(inputFile);
        FileOutputStream out = new FileOutputStream(outputFile);
        byte buffer[]=new byte[512*1024]; 
        int nbLecture; 
        while( (nbLecture = in.read(buffer)) != -1 ) { 
            out.write(buffer, 0, nbLecture);
        }
        in.close();
        out.close();
    }    
}
